<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
    
    protected function success($data=[])
    {
        return [
            'data' => $data,
            'code' => 20000
        ];
    }

    protected function error($data, $code = 20001)
    {
        return [
            'data'=>$data,
            'code'=>$code
        ];
    }
    protected function successClient($data=[], $info = '')
    {
        return [
            'info' => $info,
            'data' => $data,
            'code' => 20000
        ];
    }

    protected function errorClient($data, $info = '')
    {
        return [
            'info' => $info,
            'data' => $data,
            'code' => 20001
        ];
    }
    
    protected function backJsonClient($data, $info = '', $code = 20002)
    {
        return [
            'info' => $info,
            'data' => $data,
            'code' => $code
        ];
    }

    public static function debug($data, $code = 99999)
    {
    }
}
